import os
import yaml

""" 读取appium-yaml配置文件 """
def readYaml(path):
    with open(path, "r+", encoding="utf-8") as file:
        data = yaml.load(stream=file, Loader=yaml.FullLoader)
        return data


""" 测试类 读取yaml文件测试用例要输入的值 """
def read_test_data(path):
    with open(path, "r+", encoding="utf-8") as f:
        data = yaml.safe_load(f)
    return data['test_data']


if __name__ == '__main__':
    rootPath = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
    print(rootPath)
    path = os.path.join(rootPath, "./config/config.yaml")
    path1 = os.path.join(rootPath, "F:/TJC/TestCode/QC_APP/QC_APP_TestCode2/data/index_page.yaml")
    print(readYaml(path1))
